//
// Created by sgyt on 2020/1/6.
// 更改工作目录

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

int main(int argc,char *argv[])
{
    char buf[1024];
    size_t size;
    memset(buf,0x00, sizeof(buf));
    if(getcwd(buf,1024)<0)
    {
        printf("getcwd is error\n");
    }
    printf("cwd = %s \n",buf);

    //改变工作路径
    if(chdir("/data")<0)
    {
        printf("chdir is error\n");
    }

    memset(buf,0x00, sizeof(buf));
    if(getcwd(buf,1024)<0)
    {
        printf("getcwd is error\n");
    }

    printf("cwd = %s \n",buf);

    return 1;
}

